Shader "Custom/ModelTransform" {
	Properties {
		// _MainTex ("Base (RGB)", 2D) = "white" {}
	}
	
	CGINCLUDE
	#include "UnityCg.cginc"
	float4x4 _Tran1;
	float4x4 _Tran2;
	
	struct v2f{
		float4 pos:SV_POSITION;
		float4 col:COLOR;
	};
	
	v2f vert(appdata_base input){
		v2f output;
		float weight0 = input.vertex.z + 0.5;
		
		float4 blendedVertex = weight0 * mul(_Tran1,input.vertex) 
		+ (1.0 - weight0) * mul(_Tran2,input.vertex);
		
		float4x4 modelMatrixInverse = _Object2World * unity_Scale.w;
		modelMatrixInverse[3][3] = 1.0;
		
		float4x4 viewMatrix = mul(UNITY_MATRIX_MV,modelMatrixInverse);
		output.pos = mul(UNITY_MATRIX_P,mul(viewMatrix,blendedVertex));
		
		// output.pos = mul(UNITY_MATRIX_MVP,blendedVertex);
		
		output.col = float4(weight0,1.0 - weight0,0.0,1.0);
		return output;
	}
	float4 frag(v2f input):COLOR{
		return input.col;
	}
	
	ENDCG
	
	SubShader {
		Tags { "RenderType"="Opaque" }
		LOD 200
		Pass{
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			ENDCG
		}
	} 
	FallBack "Diffuse"
}
